class Solution
{
public:
    long long countVowels(string word)
    {
        const unordered_set<char> vowels{'a', 'e', 'i', 'o', 'u'};
        long long n = word.size();
        long long result = 0;
        for (long long i = 0; i < n; ++i)
        {
            if (vowels.count(word[i]))
            {
                result += (i + 1) * (n - i);
            }
        }
        return result;
    }
};